package com.hong.qrpc.header;

import lombok.ToString;

/**
 * @Author HQT
 * @Date 2022/8/9 11:01
 */
@ToString
public class QrpcHeader implements Header, Cloneable {
    private int version;
    private int serializationType;
    private long requestId;
    private int dataLen;

    public QrpcHeader(int version, int serializationType, long requestId, int dataLen) {
        this.version = version;
        this.serializationType = serializationType;
        this.requestId = requestId;
        this.dataLen = dataLen;
    }

    public QrpcHeader() {
    }

    public int getVersion() {
        return version;
    }

    public QrpcHeader setVersion(int version) {
        this.version = version;
        return this;
    }

    public int getSerializationType() {
        return serializationType;
    }

    public QrpcHeader setSerializationType(int serializationType) {
        this.serializationType = serializationType;
        return this;
    }

    public long getRequestId() {
        return requestId;
    }

    public QrpcHeader setRequestId(long requestId) {
        this.requestId = requestId;
        return this;
    }

    public int getDataLen() {
        return dataLen;
    }

    public QrpcHeader setDataLen(int dataLen) {
        this.dataLen = dataLen;
        return this;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return new QrpcHeader(version, serializationType, requestId, dataLen);
    }
}
